# 修复 echarts 安装脚本
$ErrorActionPreference = "Stop"

# 获取脚本所在目录
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$adminPath = Join-Path $scriptPath "client_admin"

Write-Host "正在安装 echarts 到: $adminPath"

if (Test-Path $adminPath) {
    Push-Location $adminPath
    try {
        Write-Host "当前目录: $(Get-Location)"
        Write-Host "正在安装 echarts..."
        npm install echarts --save --legacy-peer-deps
        Write-Host "安装完成！"
        
        # 验证安装
        if (Test-Path ".\node_modules\echarts") {
            Write-Host "✓ echarts 已成功安装"
        } else {
            Write-Host "✗ echarts 安装失败，未找到 node_modules\echarts"
        }
    } catch {
        Write-Host "安装失败: $_" -ForegroundColor Red
    } finally {
        Pop-Location
    }
} else {
    Write-Host "未找到 client_admin 目录: $adminPath" -ForegroundColor Red
}



